﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;

namespace InnovTech.Data.NHibernate
{
    public class SessionFactoryProvider
    {
        public Configuration Configuration { get; set; }
        public ISessionFactory CreateSessionFactory(Configuration config = null)
        {
            if (config != null)
                Configuration = config;

            if (Configuration == null)
                throw new ArgumentNullException("There is no Configuration set on this provider");

            return Configuration.BuildSessionFactory();
        }
    }
}
